/**
 * Created by yuming619 on 2016/11/25.
 */
//服务
angular.module('mealplan.service.service', ['ngResource'])
    .service('ServiceTopService',  ['$resource', function ($resource) {
        var resource = $resource(cmturl + "service/:serviceid");

        this.insert = function (service, success, error) {
            var resource = $resource(cmturl + "service");
            return resource.save({}, service, success, error);
        };
        this.selectbyall = function () {
            return resource.query();
        }

        this.getbyid = function (serviceid) {
            return resource.get({serviceid: serviceid});
        }
        this.update = function (serviceid, service, success, error) {
            return resource.save({serviceid: serviceid}, service, success, error);
        }
        this.remove = function (serviceid) {
            return resource.remove({serviceid: serviceid});
        }
        this.selectbyname = function (name, success, error) {
            var resource = $resource(cmturl + "service/selectbyname/:name");
            return resource.get({name: name}, success, error);
        }
    }])